from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

engine = create_engine(
    'mysql+pymysql://root:123123@127.0.0.1:3306/web2025?charset=utf8mb4',
    echo=True
) 

SessionLocal = sessionmaker(bind=engine)

Base = declarative_base()

def get_db():
    current_db = SessionLocal()
    try:
        yield current_db
    finally:
        current_db.close()
